import http from '@/plugins/aixos'

export function calculatePower(args: Record<string, any>) {
  const url =
    '/calculate-power/calculate?' +
    Object.entries(args)
      .map(([key, value]) => `${key}=${value}`)
      .join('&')
  return http.request({
    url,
    method: 'GET',
  })
}

export function findPower(id: number) {
  const url = `/calculate-power/${id}`
  return http.request<PowerModel>({
    url,
    method: 'GET',
  })
}

export function findAllConfig(args: Record<string, any>) {
  const url =
    `/calculate-power/all?` +
    Object.entries(args)
      .map(([key, value]) => `${key}=${value}`)
      .join('&')
  return http.request<ConfigViewModel[]>({
    url,
    method: 'GET',
  })
}
